#include <header.h>

int main(){
    int file_fd1 = open("1.txt",O_RDWR);
    int file_fd2 = open("2.txt",O_RDWR);

    struct stat st1,st2;

    char buf1[300] = {0};
    char buf2[300] = {0};

    read(file_fd1,buf1,sizeof(buf1));
    read(file_fd2,buf2,sizeof(buf2));

    fstat(file_fd1,&st1);
    fstat(file_fd2,&st2);

    if(st1.st_size == st2.st_size && memcmp(buf1,buf2,st1.st_size) == 0){
        printf("文件相同\n");
    }else{
        printf("不同\n");
    }
    return 0;
}

